package com.example.service1.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.example.service1.domain.Demo1DO;
import com.example.service1.domain.Demo2DO;
import com.example.service1.service.Demo1Service;
import com.example.service1.service.Demo2Service;
import com.example.service1.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @oauth Yeohwah
 * @createDate 2021/10/16
 * @info
 */
@RestController
@RequestMapping("/service")
public class TestController {

    @Autowired
    private DemoService demoService;
    @Autowired
    private Demo1Service demo1Service;
    @Autowired
    private Demo2Service demo2Service;

    @RequestMapping("/info")
    public String info(){
        return "service1";
    }

    @RequestMapping("/save")
    public String save(){
        demoService.save2();
        return "save";
    }
    @RequestMapping("/save1")
    public String save1(){
        Demo1DO demo1DO = new Demo1DO();
        demo1DO.setName("test seata");
        demo1Service.save(demo1DO);
        return "save";
    }
    @RequestMapping("/save2")
    public String save2(){
        Demo2DO demo2DO = new Demo2DO();
        demo2DO.setName("test seata");
        demo2Service.save(demo2DO);
        return "save";
    }
}
